-
Notifications
You must be signed in to change notification settings - Fork 34
Add Custom Error Messages #140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left a couple of comments but you can address them in a follow up pr!
also add a couple of tests with the new feature
|
|
||
| public String value(); | ||
|
|
||
| public String msg() default ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add documentation to all these fields in a follow up pr
|
|
||
| public String to() default ""; | ||
|
|
||
| public String msg() default ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add documentation here to and say that this msg should be for when the from is violated
|
|
||
| // calculate padding for line numbers | ||
| int padding = String.valueOf(endLine).length(); | ||
| String pipe = " | "; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use a static final with caps lock to represent the pipe
This PR adds support for custom messages in refinements and state refinements, through an extra parameter
msg:Examples
In the last example, the
closemethod is annotated with two state refinements, each with its own message, so both are shown. However, to simplify the error message, users should specify a message in only one of them, e.g.,"The buffered reader should be open or marked to be closed".